package com.feicheng.controller;

import com.feicheng.base.result.Result;
import com.feicheng.entity.PurchaseHeader;
import com.feicheng.model.PurchaseHeaderWithUser;
import com.feicheng.service.ProviderProcurementController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 周启博
 * @since 2022-06-27
 */
@RestController
@RequestMapping("/purchase-header")
public class PurchaseHeaderController {

    @Autowired
    ProviderProcurementController providerProcurementController;

    /**
     *
     * @param current                当前页数
     * @param size                   每页几条
     * @param purchaseHeaderWithUser 业务参数（查询条件）
     * @author feng.zhang
     * @return
     */
    @GetMapping("/page")
    public Result selectPurchaseHeaderWithUser(
            @RequestParam(defaultValue = "1") Integer current,
            @RequestParam(defaultValue = "10") Integer size,
            PurchaseHeaderWithUser purchaseHeaderWithUser
    ){
        return providerProcurementController.selectPurchaseHeaderWithUser(current,size,purchaseHeaderWithUser);
    }

    /**
     * 修改采购订单详情状态
     * @param  purchaseHeader 订单信息
     * @autor huanning.lu
     */

    @PutMapping("/info")
    public Result updateState(PurchaseHeader purchaseHeader){

        return providerProcurementController.updateState(purchaseHeader);
    }
}

